<% layout('/layouts/default.html', {title: '车辆管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> 车辆管理
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
				<% if(hasPermi('cm:smCars:edit')){ %>
					<a href="${ctx}/cm/smCars/form" class="btn btn-default btnTool" title="新增车辆管理"><i class="fa fa-plus"></i> 新增</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${smCars}" action="${ctx}/cm/smCars/listData" method="post" class="form-inline"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">车牌号：</label>
					<div class="control-inline">
						<#form:input path="carNo" maxlength="255" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">投运日期：</label>
					<div class="control-inline">
						<#form:input path="runDate" readonly="true" maxlength="20" class="form-control Wdate-date"
							dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">所属驾校：</label>
					<div class="control-inline width-120" >
						<#form:treeselect id="officeId" title="部门"
							path="officeId" labelPath="school.officeName"
							url="${ctx}/sys/office/treeData" allowClear="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">负责人：</label>
					<div class="control-inline">
						<#form:treeselect id="employeeId" title="负责人"
						path="dutyPeople" labelPath="empUser.userName"
						url="${ctx}/sys/office/treeData?isLoadUser=true"
						class=" required" allowClear="true"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">查询</button>
					<button type="reset" class="btn btn-default btn-sm">重置</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'车牌号', name:'carNo', index:'a.car_no', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/cm/smCars/form?id='+row.id+'" class="btnList" data-title="编辑车辆管理">'+(val||row.id)+'</a>';
		}},
		{header:'品牌', name:'carBrand', index:'a.car_brand', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('DSMS_CLPP')}, val, '未知', true);
		}},
		{header:'车型', name:'carType', index:'a.car_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('DSMS_CX')}, val, '未知', true);
		}},
		{header:'购买日期', name:'buyDate', index:'a.buy_date', width:150, align:"center"},
		{header:'投运日期', name:'runDate', index:'a.run_date', width:150, align:"center"},
		{header:'所属驾校', name:'school.officeName', index:'a.office_id', width:150, align:"center"},
		{header:'负责人', name:'empUser.userName', index:'a.duty_people', width:150, align:"left"},
		{header:'常驻地址', name:'parkAddress', index:'a.park_address', width:150, align:"left"},
		{header:'联系电话', name:'telephone', index:'a.telephone', width:150, align:"left"},
		{header:'车辆状态', name:'carStatus', index:'a.car_status', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('DSMS_CLZT')}, val, '未知', true);
		}},
		{header:'备注', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'操作', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('cm:smCars:edit')){ %>
				actions.push('<a href="${ctx}/cm/smCars/form?id='+row.id+'" class="btnList" title="编辑车辆管理"><i class="fa fa-pencil"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/cm/smCars/delete?id='+row.id+'" class="btnList" title="删除车辆管理" data-confirm="确认要删除该车辆管理吗？"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>